package com.tian.springboot.redis.controller;

import com.tian.springboot.redis.util.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName PageController
 * @Author duhongyan
 * @DateTime 2022年03月05日 12:24
 * @Version 1.0
 * @Description TODO
 */
@RestController
@RequestMapping
public class DemoController {

    @Autowired
    private RedisUtils redisUtils;


    @GetMapping()
//    @ResponseBody
    public String index()  {
        Integer value = (Integer)redisUtils.get("value")+1;
        redisUtils.set("value",value);
        return "访问了"+value+"次";
    }
}

